<%@ page import="schoolsource.sql.SchoolDBSQL" %>
<%@ page import="schoolsource.model.*" %>
<%@ page import="schoolsource.gui.*" %>
<%@ page import="schoolsource.security.SecurityToken" %>
<% SecurityToken st = (SecurityToken) request.getAttribute(FormFields.SESSION);
   String requestObject = (String) st.getValue(FormFields.TOKEN);
   boolean parent = (st.getValue(FormFields.ISPARENT) != null);
   String name = (String) st.getValue(SchoolDBSQL.USRFNAME) + " " + (String) st.getValue(SchoolDBSQL.USRLNAME);
   String displayTitleList[] = (String[]) st.getValue("displayTitleList");
// the displayContentList will always have the assigned ID in the first position, so it will
// be one longer than the other two lists
   Item displayContentList[][] = (Item[][]) st.getValue("displayContentList");
   int displayLengthList[] = (int[]) st.getValue("displayLengthList");
   UserContainer adminContainer = (UserContainer) st.getValue("adminContainer");
   int editorPage = (new Integer((String) st.getValue(FormFields.EDITORPAGE))).intValue();
   String displayMessage = (String) st.getValue("displayMessage");
   String subLink = (String) st.removeValue(FormFields.SUBLINK);
   st.putValue("displayMessage", ""); //
   SchoolContainer sc = SchoolContainer.getSchoolContainer(st.getValue(FormFields.SCHOOLNAME).toString());
   
   String activeMenuBar = sc.getSchoolActiveMenuBarColor().toString();
   String inactiveMenuBar = sc.getSchoolInactiveMenuBarColor().toString();
   String activeLink = sc.getSchoolActiveLinkColor().toString();
   String inactiveLink = sc.getSchoolInactiveLinkColor().toString();
   String headingColor = sc.getSchoolMenuHeadingColor().toString();
   String headingFont = sc.getSchoolHeadingFont().toString();
   String backgroundColor = sc.getSchoolMenuBackgroundColor().toString();
   String schoolLogo = sc.getSchoolLogo().toString();
   String schoolLogoWidth = sc.getSchoolLogoWidth().toString();

   String loginType = (String) request.getAttribute(FormFields.USRTYPE); 
   String schoolName = (String) request.getAttribute(FormFields.SCHOOLNAME);
%>

<HTML>
  <HEAD>
    <style>
    h1 {color:red;font-size:30}
    </style>
    <SCRIPT>
    function getProperties(x) {
        var outtext = "";
        var counter = 0;
        for (var i in x) {
            outtext = outtext + "*** " + i + ": " + x[i] + "\n";
            if (counter > 4) {
                if (!confirm(outtext)) { return; }
                outtext = "";
                counter = 0;
            }
            else {
                counter = counter + 1;
            }
        }
        if (outtext != "") {
            confirm(outtext);
        }
    }

    function getAttributeRecursive(parent, name) {
        var result = null;
        var listofnodes = parent.childNodes;
//        getProperties(parent);
//        alert("listofnodes == null: " + (listofnodes == null));
        for (var i = 0;listofnodes != null && i < listofnodes.length; i++) {
            for (var j in parent) {
                if (j == name) {
                    if (confirm("found something")) {
                        getProperties(parent[j]);
                    }
                    else {
                        alert("exiting");
                        exit(0);
                    }
                }
                else {
//                    if (!confirm("name: " + j + "\nkeep checking?")) {
//                        exit(0);
//                    }
                }
            }
            result = getAttributeRecursive(listofnodes[i], name);
        }
        return result;
    }
    
    function notify(x) {
        alert(x);
    }

    function refresh() {
        top.frames.mainframe.submitPage(top.frames.mainframe.document, "<%= FormFields.EDITORPAGE %>", <%= editorPage %>);
    }

    function initializeViewFrame(w) {
        var d = w.document;
        d.write("    <HTML><HEAD></HEAD>\n");
        d.write("    <BODY>\n");

        d.write("      <center><br><br><B>View Area<B><br><br></center>");
        d.write("      <FORM NAME=\"initialCIFrame\" METHOD=\"POST\">\n");
        d.write("        <INPUT TYPE=\"HIDDEN\" NAME=\"<%= FormFields.CURRENT %>\" VALUE=\"<%= FormFields.SUBFRAME %>\">\n");
        d.write("        <INPUT TYPE=\"HIDDEN\" NAME=\"<%= FormFields.TOKEN %>\" VALUE=\"<%= requestObject%>\">\n");
        d.write("        <INPUT TYPE=\"HIDDEN\" NAME=\"<%= FormFields.PARAMETER %>\" VALUE=\"\">\n");
        d.write("        <INPUT TYPE=\"HIDDEN\" NAME=\"<%= FormFields.LINKCLICKED %>\" VALUE=\"\">\n");
        d.write("        <INPUT TYPE=\"HIDDEN\" NAME=\"<%= FormFields.EDITORPAGE %>\" VALUE=\"<%= editorPage %>\">");
        d.write("      </FORM>\n");
        d.write("<p>&nbsp\n");
        d.write("<p>&nbsp\n");
        d.write("<p>&nbsp\n");
        d.write("    </BODY></HTML>\n");
        d.close();
    }

    function getNode(listofnodes, nodename) {
        var i = 0;
//alert("looking for " + nodename);
        for (var i = 0;i < listofnodes.length; i++) {
//alert("found: " + listofnodes.item(i).id);
            if (listofnodes.item(i).id == nodename) {
                return listofnodes[i];
            }
        }
    }

    function deleteAction(a, b, c){
        if (getNode(a.childNodes, "<%= FormFields.DELETEACTION %>").style.color != "<%= activeLink %>") {
            return;
        }
        if (confirm("Are you sure you want to delete this item?")){
            go(a,b,c,<%= editorPage %>);
        }
    }

    function initializeMenuFrame(w) {
        var d = w.document;
        d.write("    <HTML><HEAD>\n");
        d.write(" </HEAD><BODY style=\"WIDTH: 100%; COLOR:<%= headingColor %>; background:<%= backgroundColor %>; position:relative; left:0;\">\n");
        
        d.write("    <div><IMG src=\"../pics/<%= schoolLogo %>\" <%= ("".equals(schoolLogoWidth)) ? "width='90%'" : "width=" + schoolLogoWidth + ";" %> style=\"border:0;white-space:nowrap;\"><br><br>\n");
        d.write("    <FONT COLOR=\"<%= headingColor %>\" SIZE=\"4\"><B><%= adminContainer.getFirstName().toString() + " " + adminContainer.getLastName().toString()%></B></FONT><br>\n");
        d.write("      <FONT COLOR=\"<%= headingColor %>\">ID: <%= adminContainer.getSchoolID().toString() %></FONT><br>\n");
        d.write("      &nbsp;<br></div>\n");

        d.write("      <div name=\"actionmenu\" id=\"actionmenu\" \n");
        d.write("           STYLE=\"padding:1;color:<%= headingColor %>;position:relative;\n");
        d.write("           left:5;font-Style:normal;font-family:sans-serif;font-size:12;\n");
        d.write("           white-space:nowrap;\"><B>Action</B>\n");
        d.write("      <div name=\"newaction\" id=\"newaction\" STYLE=\"padding:1;color:<%= activeLink %>;position:relative;\n");
        d.write("           height:20;left:10;font-Style:normal;white-space:nowrap;\" onClick='top.frames.mainframe.go(this, 2, \"<%= FormFields.NEWACTION %>\", \"<%= editorPage %>\");'>\n");
        d.write("           <a id=\"<%= FormFields.NEWACTION %>\" href=\"\" STYLE=\"text-decoration:none;color:<%= activeLink %>;\" \n");
        d.write("               onMouseOver=\"top.frames.mainframe.makebold(this);\" \n");
        d.write("               onMouseOut=\"this.style.fontWeight='normal';\" \n");
        d.write("               onClick='return false;'>New</a></div>\n");
        d.write("      <div name=\"editaction\" id=\"editaction\" STYLE=\"padding:1;color:<%= inactiveLink %>;position:relative;\n");
        d.write("           height:20;left:10;font-Style:normal;white-space:nowrap;\" onClick=\"top.frames.mainframe.go(this, 0, '<%= FormFields.EDITACTION %>', top.frames.mainframe.getSelected());\">\n");
        d.write("           <a id=\"<%= FormFields.EDITACTION %>\" href=\"\" STYLE=\"text-decoration:none;color:<%= inactiveLink %>;\" \n");
        d.write("               onMouseOver=\"top.frames.mainframe.makebold(this);\" \n");
        d.write("               onMouseOut=\"this.style.fontWeight='normal';\" \n");
        d.write("               onClick=\"return false;\">Edit</a></div>\n");
        d.write("      <div name=\"deleteaction\" id=\"deleteaction\" STYLE=\"padding:1;color:<%= inactiveLink %>;position:relative;\n");
        d.write("           height:20;left:10;font-Style:normal;white-space:nowrap;\" onClick='top.frames.mainframe.deleteAction(this, 0, \"<%= FormFields.DELETEACTION %>\");'>\n");
        d.write("           <a id=\"<%= FormFields.DELETEACTION %>\" href=\"\" STYLE=\"text-decoration:none;color:<%= inactiveLink %>;\" \n");
        d.write("               onMouseOver=\"top.frames.mainframe.makebold(this);\" \n");
        d.write("               onMouseOut=\"this.style.fontWeight='normal';\" \n");
        d.write("               onClick=\"return false;\">Delete</a></div><BR>\n");
        d.write("      </div>\n");
        
        
        d.write("      <div name=\"mainmenu\" id=\"mainmenu\" \n");
        d.write("           STYLE=\"padding:1;color:<%= headingColor %>;position:relative;\n");
        d.write("           font-family:sans-serif;left:5;font-Style:normal;\n");
        d.write("           font-size:12;white-space:nowrap;\"><B>Services</B>\n");
        d.write("      <div name=\"changepw\" id=\"changepw\" \n");
        d.write("           STYLE=\"padding:1;color:<%= activeLink %>;position:relative;height:20;left:10;font-Style:normal;\n");
        d.write("           white-space:nowrap;\" onClick='top.frames.mainframe.go(this, 5, \"<%= FormFields.CHANGEPASSWORD %>\", \"-1\");'>\n");
        d.write("           <a id=\"<%= FormFields.CHANGEPASSWORD %>\" href=\"\" STYLE=\"text-decoration:none;color:<%= activeLink %>;\" onMouseOver=\"top.frames.mainframe.makebold(this);\" onMouseOut=\"this.style.fontWeight='normal';\" onClick='return false;'>Change Password</a></div>\n");
        d.write("      <div name=\"refresh\" id=\"refresh\" STYLE=\"padding:1;color:<%= activeLink %>;position:relative;\n");
        d.write("           height:20;left:10;font-Style:normal;white-space:nowrap;\" onClick='top.frames.mainframe.refresh();'>\n");
        d.write("           <a id=\"<%= FormFields.REFRESH %>\" href=\"\" STYLE=\"text-decoration:none;color:<%= activeLink %>;\" onMouseOver=\"top.frames.mainframe.makebold(this);\" \n");
        d.write("           onMouseOut=\"this.style.fontWeight='normal';\" onClick=\"return false;\">\n");
        d.write("           Refresh</a></div>\n");
        d.write("      <div name=\"logout\" id=\"logout\" STYLE=\"padding:1;color:<%= activeLink %>;position:relative;\n");
        d.write("           height:20;left:10;font-Style:normal;white-space:nowrap;\" onClick='top.frames.mainframe.submitPage(top.frames.mainframe.document,\"<%= FormFields.LOGOUT %>\", -1);'>\n");
        d.write("           <a id=\"<%= FormFields.LOGOUT %>\" href=\"\" STYLE=\"text-decoration:none;color:<%= activeLink %>;\" onMouseOver=\"top.frames.mainframe.makebold(this);\"\n");
        d.write("           onMouseOut=\"this.style.fontWeight='normal';\" onClick=\"return false;\">\n");
        d.write("           Logout</a></div>\n");
        d.write("      </div>\n");
        
        d.write("    </BODY></HTML>\n");
        d.close();
    }

    function blankouterframes() {
        top.frames.viewframe.document.write("<HTML><HEAD></HEAD><BODY></BODY></HTML>");
        top.frames.viewframe.document.close();
        top.frames.menuframe.document.write("<HTML><HEAD></HEAD><BODY></BODY></HTML>");
        top.frames.menuframe.document.close();
    }

    function submitPage(d, linkclicked, val) {
        if (linkclicked == "<%= FormFields.LOGOUT %>") {
            blankouterframes();
        }
        d.forms[0].<%= FormFields.LINKCLICKED %>.value = linkclicked;
        d.forms[0].<%= FormFields.PARAMETER %>.value = val;
        d.forms[0].submit();
    }

    function goToNextPage(linkclicked, val) {
        var d = top.frames.viewframe.document;
        d.forms[0].<%= FormFields.LINKCLICKED %>.value = linkclicked;
        d.forms[0].<%= FormFields.PARAMETER %>.value = val;
        d.forms[0].submit();
    }

    function deletetoken() {
        document.forms[0].submit();
    }

    function contract(k) {
        var nextSib = k.nextSibling;
        k.style.border = "none";
        while (nextSib != null && nextSib.style != null && nextSib.style.posLeft != 0 && nextSib.style.posLeft < (k.style.posLeft + k.clientWidth)) {
            nextSib.style.clip = "rect(auto " + nextSib.style.clipWidth + "px auto auto)";
            nextSib = nextSib.nextSibling;
        }
        k.style.clip = "rect(auto " + k.style.clipWidth + "px auto auto)";
        k.style.overflow = "hidden";
    }


    function expand(k) {
        var additionalSpace = 5;
        var nextSib = k.nextSibling;
        var newClip = 0;
        k.style.borderWidth = 1;
        k.style.borderColor = "black";
        k.style.borderStyle = "solid";
        k.style.overflow = "visible";
        while (nextSib != null && nextSib.style != null && nextSib.style.posLeft >= k.style.posLeft && nextSib.style.posLeft < (k.style.posLeft + k.clientWidth + additionalSpace)) {
            if ((k.style.posLeft + k.clientWidth + additionalSpace) > (nextSib.style.posLeft + nextSib.clientWidth)) {
                newClip = nextSib.clientWidth;
            }
            else {
                newClip = additionalSpace + k.style.posLeft + k.clientWidth - nextSib.style.posLeft;
            }
            nextSib.style.clip = "rect(auto " + nextSib.style.clipWidth + "px auto " + newClip + "px)";
            nextSib = nextSib.nextSibling;
        }
        k.style.clip = "rect(auto auto auto auto)";
    }

    var highlighteddiv = null;
    
    function highlight(k) {
        var nextdiv = k.parentNode.firstChild;
        state = 1;
        if (highlighteddiv != null) {
            highlighteddiv.style.background = "#FFFFFF";
        }
        highlighteddiv = k;
        k.style.background = "#CCCCCC";
        updateMenu();
    }
    
    function showChildren(k) {
    alert("showing children");
        for (var i = 0;i < k.childNodes.length; i++) {
	    alert("id: " + k.childNodes.item(i).id);
	    getProperties(k.childNodes.item(i));
        }
    }
    
    function getNodeRecursive(parent, id) {
        var result = null;
        var listofnodes = parent.childNodes;
        for (var i = 0;i < listofnodes.length; i++) {
            if (listofnodes.item(i).id == id) {
                return listofnodes.item(i);
            }
            else {
                result = getNodeRecursive(listofnodes[i], id);
                if (result != null) {
                    return result;
                }
            }
        }
        return result;
    }
    
    var show = true;
    
    function highlightByID(id) {
        var header = getNodeRecursive(top.frames.mainframe.document.body, id);
        highlight(header);
//        setSelected(header);
        setSelected(id);
//        if ((header.parentNode.offsetHeight + header.parentNode.scrollTop) < (header.offsetHeight * getNumber(header)) ||
  //          header.parentNode.scrollTop > (header.offsetHeight * (getNumber(header) - 1))) {
    //        header.parentNode.scrollTop = (getNumber(header) - 2) * header.offsetHeight + 4;
      //  }
    }
    
    function getNumber(node) {
        var i = 0;
        var temp = node;
        while (temp != null) {
            if (temp.nodeType != 1) {
                --i;
            }
            ++i;
            temp = temp.previousSibling;
        }
        return i;
    }
    
    function makebold(k) {
        if (k.style.color == "<%= activeLink %>") {
            k.style.fontWeight = 'bold';
        }
    }
    
    function go(k, newstate, option, param) {
        var temp = getNode(k.childNodes, option);
        if (temp.style.color != "<%= activeLink %>")  {
            return;
        }
        state = newstate;
        updateMenu();
        if (option != null && param != null) {
            goToNextPage(option, param);
        }
    }

    function updateMenu() {
         var actionmenu = getNode(top.frames.menuframe.document.body.childNodes, "actionmenu");
         var newaction = getNode(getNode(actionmenu.childNodes, "newaction").childNodes, "<%= FormFields.NEWACTION %>");
         var editaction = getNode(getNode(actionmenu.childNodes, "editaction").childNodes, "<%= FormFields.EDITACTION %>");
         var deleteaction = getNode(getNode(actionmenu.childNodes, "deleteaction").childNodes, "<%= FormFields.DELETEACTION %>");

         var mainmenu = getNode(top.frames.menuframe.document.body.childNodes, "mainmenu");
         var changepw = getNode(getNode(mainmenu.childNodes, "changepw").childNodes, "<%= FormFields.CHANGEPASSWORD %>");
         var refresh = getNode(getNode(mainmenu.childNodes, "refresh").childNodes, "<%= FormFields.REFRESH %>");
         var logout = getNode(getNode(mainmenu.childNodes, "logout").childNodes, "<%= FormFields.LOGOUT %>");

        // state 0 is nothing selected
        if (state == 0) {
            changepw.style.color = "<%= activeLink %>";
            refresh.style.color = "<%= activeLink %>";
            logout.style.color = "<%= activeLink %>";
            newaction.style.color = "<%= activeLink %>";
            editaction.style.color = "<%= inactiveLink %>";
            deleteaction.style.color = "<%= inactiveLink %>";
        }
        // state 1 is item selected (is viewing)
        else if (state == 1) {
            changepw.style.color = "<%= activeLink %>";
            refresh.style.color = "<%= activeLink %>";
            logout.style.color = "<%= activeLink %>";
            newaction.style.color = "<%= activeLink %>";
            editaction.style.color = "<%= activeLink %>";
            deleteaction.style.color = "<%= activeLink %>";
        }
        // state 2 is creating new item
        else if (state == 2) {
            changepw.style.color = "<%= activeLink %>";
            refresh.style.color = "<%= activeLink %>";
            logout.style.color = "<%= activeLink %>";
            newaction.style.color = "<%= activeLink %>";
            editaction.style.color = "<%= inactiveLink %>";
            deleteaction.style.color = "<%= inactiveLink %>";
        }
        // state 3 is editing item
        else if (state == 3) {
            changepw.style.color = "<%= activeLink %>";
            refresh.style.color = "<%= activeLink %>";
            logout.style.color = "<%= activeLink %>";
            newaction.style.color = "<%= activeLink %>";
            editaction.style.color = "<%= inactiveLink %>";
            deleteaction.style.color = "<%= inactiveLink %>";
        }
    }

    function setSelected(k) {
    
      selectedItem = k;
    }

    function getSelected() {
      return top.frames.mainframe.selectedItem;
    }

    function init() {
        top.frames.mainframe.initializeViewFrame(top.frames.viewframe);
        top.frames.mainframe.initializeMenuFrame(top.frames.menuframe);
        if ("<%= displayMessage %>" != "null" && "<%= displayMessage %>" != "") {
          top.frames.mainframe.notify("<%= displayMessage %>");
          top.frames.mainframe.refresh();
        }

        <%= (subLink == null || "".equals(subLink)) ? "" : "setSelected(" + subLink + ");goToNextPage('VIEWACTION', getSelected());" %>
    }

    </SCRIPT>
  </HEAD>
  <BODY onLoad="init()" >
    <FORM NAME="editorform" METHOD="POST">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.CURRENT %>" VALUE="<%= FormFields.EDITORPAGES[editorPage] %>">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.TOKEN %>" VALUE="<%= requestObject%>">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.PARAMETER %>" VALUE="">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.LINKCLICKED %>" VALUE="">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.EDITORPAGE %>" VALUE="<%= editorPage %>">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.SUBLINK %>" VALUE="">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.SCHOOLNAME %>" VALUE="<%= schoolName %>">
      <INPUT TYPE="HIDDEN" NAME="<%= FormFields.USRTYPE %>" VALUE="<%= loginType %>">
    </FORM>

    <SPAN STYLE="font-size:13;font-Style:normal;position:absolute; top:0px; left:0;background-color: <%=backgroundColor%>; font-family:times roman;width:100%;">
    	<LEFT>
			<a STYLE="color: <%=headingColor%>;font-Style:normal;position:absolute; top:0px;left:0;background-color: <%=backgroundColor%>; font-family:times roman;">&gt;&gt;<I>my</I>Admin&nbsp&nbsp</a><HR>
		</LEFT>
		<CENTER>
      	<%
        for (int i = 0; i < FormFields.EDITORPAGES.length-1; i++) {
        	if (editorPage == i){
            	out.print("<a STYLE=\"position:relative;padding-left:5;padding-right:5;font-family:"+ headingFont +";font-weight:bold;vertical-align:top;text-decoration:none;color:" + inactiveMenuBar + ";\" type=\"text\" href=\"\" onClick='return false;'>");
            	out.print(" "+ FormFields.EDITORPAGES[i] + " ");
			}
           	else{
             	out.print("<a STYLE=\"position:relative;vertical-align:top;text-decoration:none;color:" + activeMenuBar + ";font-family:"+ headingFont +";\" align=\"bottom\" type=\"text\" verticalAlign=\"bottom\" href=\"\" onClick='submitPage(top.frames.mainframe.document,\"" + FormFields.EDITORPAGE + "\", " + i + "); return false;'>");
             	out.print(" "+ FormFields.EDITORPAGES[i] + " ");
           	}
           	out.print("</a>&nbsp<B STYLE=\"color:white;\">|</B>&nbsp");
        }

        int ii = FormFields.EDITORPAGES.length-1;
        if (editorPage == ii){
           	out.print("<a STYLE=\"padding-left:5;padding-right:5;font-family:"+ headingFont +";font-weight:bold;vertical-align:top;text-decoration:none;color:" + inactiveMenuBar + ";\" type=\"text\" href=\"\" onClick='return false;'>");
           	out.print(" "+ FormFields.EDITORPAGES[ii] + " ");
           	out.print("</a>");
        }
        else{
           	out.print("<a STYLE=\"vertical-align:top;text-decoration:none;color:" + activeMenuBar + ";font-family:"+ headingFont +";\" align=\"bottom\" type=\"text\" verticalAlign=\"bottom\" href=\"\" onClick='submitPage(top.frames.mainframe.document,\"" + FormFields.EDITORPAGE + "\", " + ii + "); return false;'>");
           	out.print(" "+ FormFields.EDITORPAGES[ii] + " ");
           	out.println("</a>");
        }
      	%>
      	<HR>
      	</CENTER>
    </SPAN>

	<span ID="SPAN">
 	<CENTER ID="CENTER">
 	<br><br>
 	<FONT SIZE = "4">
 	<B>
  <%
    if (editorPage != -1) {
      out.println(FormFields.EDITORPAGES[editorPage] + " List");
    }
    else {
      out.println("");
    }
  %>
  </B></FONT>
  <TABLE ID="TABLE" style="position:relative;top:0;left:0;font-family:<%= headingFont %>;">
    <TR>
     <TD ALIGN="LEFT" width=275>
      <div id="headersView" style="position:absolute;border-color: #000000; border-width: 1px; border-style: solid; overflow:auto; width:550; height:180">
        <% 
          int offset = 5;
          for (int i = 0; i < displayTitleList.length; i++) {
              out.print("<div STYLE=\"position:absolute;top:0;font-size:12;font-family:" + headingFont + ";left:" + offset + ";width:" + displayLengthList[i] + "\"><b>");
              out.print(displayTitleList[i]);
              out.println("</b></div>");
//              offset = offset + (150-DisplayString.size(displayTitleList[i].toString(), 4));
			  offset = offset + (displayLengthList[i])+10;
          } 
        %>
        <%
          for (int i = 0; i < displayContentList.length; i++) {
            offset = 5;
            out.print("<div id=\"" + displayContentList[i][0] + "\" STYLE=\"font-size:11;font-family:"+ headingFont +";padding:1;position:absolute;top:"+((i+1)*1.5)+
                "em;left:0;width:500;\" onClick=\"highlight(this);"+
                "setSelected(" + displayContentList[i][0] + ");goToNextPage('" + FormFields.VIEWACTION + "', getSelected());\">&nbsp;");

            for (int j = 1; j < displayContentList[i].length; j++) {
                out.println("<div STYLE=\"padding:1;color:blue;position:absolute;top:0;left:" + offset + ";width:" + displayLengthList[j-1]+";"
                	+ "clipWidth:" + displayLengthList[j-1] + ";\">" 
                    + "<a href=\"\" onClick='return false;'>"+
                      DisplayString.getTruncatedString(displayContentList[i][j].toString(), displayLengthList[j-1], 4) + "</a></div>");
//                  offset = offset + (150-DisplayString.size(displayContentList[i][j].toString(), 4));
                  offset = offset + (displayLengthList[j-1])+10;
            }
            out.println("</div>");
          }
        %>
      </div>
    </TD><TD width=275>&nbsp;</TD></TR>
  </TABLE>
</CENTER>
</SPAN>
  </BODY>
</HTML>